package com.linkoog.devtools.dubbo.raw_index;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.linkoog.devtools.metadata.raw_index.MethodMetadata;
import com.linkoog.devtools.type.Type;
import lombok.Getter;
import lombok.ToString;
import org.jetbrains.annotations.NotNull;

import java.util.List;

@ToString(callSuper = true)
public class DubboMethod extends MethodMetadata {

    /**
     *  当前的接口的类名
     */
    @Getter
    private final String className;
    /**
     *  dubbo接口的来源
     *  1、xml文件声明方式： xml-provider、xml-consumer
     *  2、注解声明方式：   anno-provider、anno-consumer
     */
    @Getter
    private final String sourceType;
    /**
     *  服务的接口的类名
     */
    @Getter
    private final String inface;
    @Getter
    private final String version;
    @Getter
    private final String group;


    @JsonCreator
    public DubboMethod(@JsonProperty("filePath")@NotNull String filePath,
                       @JsonProperty("psiElementOffset") int psiElementOffset,
                       @JsonProperty("name")@NotNull String name,
                       @JsonProperty("paramTypes")@NotNull List<Type> paramTypes,
                       @JsonProperty("returnType")@NotNull Type returnType,
                       //自定义属性
                       @JsonProperty("className")@NotNull String className,
                       @JsonProperty("sourceType")@NotNull String sourceType,
                       @JsonProperty("inface")@NotNull String inface,
                       @JsonProperty("version")@NotNull String version,
                       @JsonProperty("group")@NotNull String group

    ) {
        super(filePath, psiElementOffset, name, paramTypes, returnType);
        this.className = className;
        this.sourceType = sourceType;
        this.inface = inface;
        this.group = group;
        this.version = version;
    }

}
